package com.labot.authentication.encryp;

import java.security.Key;

public class HashSecutityKeyImpl implements Key {

	private static final long serialVersionUID = -2342342342342342345L;
	
	private String hash = null;
	
	public void setHash(String hash) throws Exception {
		if(hash == null) {
			throw new Exception("Null Hash");
		}
		if(hash.length()<24) {
			throw new Exception("Hash < 24 chars");
		}
		
		this.hash = hash.substring(0,24);
	}

	public String getAlgorithm() {
		return "DESede";
	}

	public byte[] getEncoded() {
//		byte[] encoded = {-29, -2, 37, 97, 74, 73, 118, 38, -51, 100, 38, -38, -75, -43, 38, 121, 69, 117, 79, 31, 115, 50, -9, 118 };
		return hash.getBytes();
	}

	public String getFormat() {
		return "RAW";
	}

}
